package persistencia;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import util.Conexion;
import bean.Catalogo;

public class TTIMADAO {

	public List<Catalogo> getTiposMovimiento(String clase) throws SQLException{
		List<Catalogo> almacenes = new ArrayList<Catalogo>();
		PreparedStatement pstm = Conexion.obtenerConexion().prepareStatement("select tmtipo,tmdesc from ttima where tmclas=? order by tmtipo");
		pstm.setString(1, clase);
		ResultSet rs = pstm.executeQuery();
		while(rs.next()){
			Catalogo catalogo = new Catalogo();
			catalogo.setCodigo(rs.getString("tmtipo"));
			catalogo.setDescripcion(rs.getString("tmdesc"));
			almacenes.add(catalogo);
		}
		rs.close();
		pstm.close();
		return almacenes;
	}	
	
}
